home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-10-04 | 4.0 KB | 124 lines |
- package sub_arctic.anim;
-
- import sub_arctic.input.event;
-
- /**
- * This is a transition for people who want to have a transition
- * which lasts until you specifically remove it. This object <I>never</I>
- * calls the animatable's end_transition function, only start_transition
- * and the transition_step function. This object doesn't use
- * trajectory or a pacing function, it just converts the current time
- * into a Float object and sends that to the animatable. This object
- * requires a continuous_interval for its time interval so it is sure
- * that you will not pass it an interval which expires.
- *
- * @author Ian Smith
- */
- public class continuous_transition extends transition {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * How often does the user want calls (in milliseconds).
- */
- protected int _freq;
-
- /**
- * Retrieve the frequency of calls to this animatable object.
- * @return int the frequency of calls in milliseconds
- */
- public int frequency() { return _freq;}
-
- /**
- * Set the frequency of calls to this animatable object.
- * @param int f frequency of calls in milliseconds
- */
- public void set_frequency(int f) { _freq=f;}
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Construct a permanent transition given an animatable object
- * and a frequency of calls.<p>
- *
- * @param animatable a the object to animate
- * @param continuous_interval pi
- * @param int freq the frequency of calls in milliseconds
- */
- public continuous_transition(animatable a, continuous_interval pi,int freq) {
- super(a,pi,null);
- _freq=freq;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This object is never finished.
- * @return boolean always return false
- */
- public boolean finished() { return false;}
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Start a transition.
- *
- * @param event e the animation event that caused things to get going
- * @param Object user_info the object passed to the animation agent when
- * the animatable joined its focus set
- */
- public void start(event e,Object user_info) {
-
- _last_time=time_interval.now();
-
- /* just get the current time and shove it in */
- target().start_transition(this, null, 0.0, new Float(_last_time),
- e,user_info);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Perform a step... this sends the transition_step message to the
- * interactor.<p>
- *
- * @param event e the animation event for this step
- * @param Object user_info the object passed to the animation agent when
- * the animatable joined its focus set
- * @param long current_time the time it is "now" for this time step
- */
- public void step(event e, Object user_info, long current_time) {
-
- /* has the frequency passed */
- if (current_time-_last_time>_freq) {
-
- /* it has passed, send the message */
- target().transition_step(this, null, 0.0,new Float(_last_time),
- 0.0, new Float(current_time),
- e, user_info);
- _last_time=current_time;
-
- }
-
- /* if the time hasn't passed, we ignore this event */
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-